<template>
    <div class="ding">
      <center><h1>订单列表</h1></center>
      商品名称：<el-input v-model="from.gname" placeholder="请输入内容" style="width: 200px"></el-input>

      下单时间：<el-date-picker
        v-model="from.start"
        type="date"
        placeholder="选择日期">
      </el-date-picker>
      <el-date-picker
        v-model="from.end"
        type="date"
        placeholder="选择日期">
      </el-date-picker>
      <el-button type="primary" @click="initData">查询</el-button>
      <el-table
        :data="pageInfo.list"
        style="width: 100%">
        <el-table-column
          prop="oid"
          label="订单编号"
        >
        </el-table-column>
        <el-table-column
          prop="gname"
          label="商品名称"
        >
        </el-table-column>
        <el-table-column
          prop="omoney"
          label="商品金额">
        </el-table-column>

        <el-table-column
          prop="createtime"
          label="下单时间">
        </el-table-column>
      </el-table>
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="pageInfo.pageNum"
        :page-sizes="[2, 200, 300, 400]"
        :page-size="pageInfo.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="pageInfo.total">
      </el-pagination>
    </div>
</template>

<script>
    export default {
        name: "Ding",
      data(){
          return{

            from:{
              gname:"",
              start:"",
              end:"",
            },
            pageInfo:{},
            froms:{
              pageNum:1,
              pageSize:2,
            }
          }
      },
      methods:{
        handleSizeChange(val){
          this.froms.pageSize=val;
          this.initData();
        },
        handleCurrentChange(val){
          this.froms.pageNum=val;
          this.initData();
        },
        initData(){
          this.axios.post(`http://localhost:9001/api/order/findAlls?pageNum=${this.froms.pageNum}&pageSize=${this.froms.pageSize}`,this.from).then(res=>{
            this.pageInfo=res.data;
          })
        }

      },
      created(){
this.initData();
      }
    }
</script>

<style scoped>

</style>
